<?php
/**
 * User: aka
 * Time: 0:15
 */

namespace app\tenno\controller;

use think\Request;

class Prime
{
    public function warFrame()
    {
        $warFrameList = \app\tenno\model\Prime::index(0)
            ->type(2)
            ->paginate(10)
            ->each(
                function($item)
                {
                    $item->uid = \app\tenno\model\Users::userInfo($item->uid)
                        ->find();
                }
            );
        return view('war_frame', ['war_frame_list' => $warFrameList]);
    }

    public function weapon()
    {
        $weaponList = \app\tenno\model\Prime::index(0)
            ->type(1)
            ->paginate(10)
            ->each(
                function($item)
                {
                    $item->uid = \app\tenno\model\Users::userInfo($item->uid)
                        ->find();
                }
            );
        return view('weapon', ['weapon_list' => $weaponList]);
    }

    public function sendWeapon()
    {
        return view();
    }

    public function sendWarFrame()
    {
        return view();
    }

    public function editWeapon(Request $request)
    {
        $id = base64_decode($request->param('id'));
        $oldData = \app\tenno\model\Prime::get($id);
        return view('edit_weapon',['data' => $oldData]);
    }

    public function editWarFrame(Request $request)
    {
        $id = base64_decode($request->param('id'));
        $oldData = \app\tenno\model\Prime::get($id);
        return view('edit_war_frame',['data' => $oldData]);
    }
}